Clarify private key permissions in Set-DbaNetworkCertificate help - #10586
Merged
potatoqualitee merged 1 commit intoAug 20, 2026
Merged
Conversation
…private key The help said the command grants read permissions "for the service account", but the code grants them to the per-service SID of the instance (NT SERVICE\MSSQLSERVER, or NT SERVICE\MSSQL$<InstanceName> for named instances). Readers assumed the startname of the service was used, which caused confusion in the issue. Documentation only - no code changed. The .OUTPUTS ServiceAccount property still documents the startname reported by WMI, which is correct as written. Refs #10125 (do Set-DbaNetworkCertificate) Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Member
|
thank you 🙏🏼 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Documentation-only fix for the wording that caused the confusion in #10125.
Problem
The comment-based help said:
Readers reasonably take "the service account" to mean the startname of the service. That is not what the code does, and @rjleue hit exactly that in #10125 — their SCOM monitoring flagged the instance because the expected ACE was not on the startname.
Mechanism
The code grants
Readon the private key file to the per-service SID of the instance —NT SERVICE\MSSQLSERVERfor the default instance,NT SERVICE\MSSQL$<InstanceName>for named instances (Set-DbaNetworkCertificate.ps1#L193-L206):The service SID is always part of the process token of the SQL Server service, so this grants the running instance exactly the access Microsoft's docs ask for, and it survives a change of the startup account. With the default virtual account the two are literally the same object; the difference only shows up with a domain account or a gMSA.
So the behaviour is correct — the help was not.
What changed
Two blocks of comment-based help in
public/Set-DbaNetworkCertificate.ps1:.DESCRIPTION— now names the per-service SID explicitly and explains why it is used instead of the startname..PARAMETER Thumbprint— dropped the "the SQL Server service account will be granted read permissions to it" clause and points at the description.What deliberately did not change
.OUTPUTSServiceAccountstill reads "The service account running the SQL Server instance". That property comes from$wmiService.ServiceAccountand really is the startname, so the wording is accurate there.Sweep for the same wording elsewhere
Set-DbaNetworkCertificateis the only command in the repo that ACLs a certificate private key —NT SERVICE\MSSQLappears nowhere else inpublic/orprivate/outside of this command. I checked the sibling network-certificate commands and the computer-certificate family:Get-DbaNetworkCertificate,Test-DbaNetworkCertificate,New-DbaComputerCertificate,Add-DbaComputerCertificate,Backup-DbaComputerCertificate— none of them claim to grant private key permissions, so there is nothing to correct.Remove-DbaNetworkCertificatementionsServiceAccountonly as an output property, same accurate usage as above.No other help text needed changing.
Testing
Documentation-only, so no behavioural test applies. Verified that the file parses cleanly with
[System.Management.Automation.Language.Parser]::ParseFileand that the help block still renders as intended viaGet-Help -Full, including the literalMSSQL$<InstanceName>surviving PowerShell's parsing of the comment block.Reported by @rjleue in #10125.